import type {
  GraduationMaterialAddDTOType,
  GraduationMaterialSearchDTOType,
  GraduationMaterialUpdateDTOType,
} from '@/resources/interface/graduationMaterial/GraduationMaterialTypes'
import type { ResultTypes } from '@/resources/interface/ResultTypes'
import { HttpResultUtil } from '@/apis/utils/HttpResultUtil'
import type { AuditApplicationDTOType } from '@/resources/interface/projectApplication/ProjectApplicationTypes.ts'

export class GraduationMaterialApi {
  private static addUrl: string = '/graduationMaterial/add'
  private static updateUrl: string = '/graduationMaterial/update'
  private static searchUrl: string = '/graduationMaterial/search'
  private static deleteUrl: string = '/graduationMaterial/delete'
  private static auditUrl: string = '/graduationMaterial/audit'

  static audit(data: AuditApplicationDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.auditUrl, data, true)
  }

  static add(data: GraduationMaterialAddDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.addUrl, data, true)
  }

  static update(data: GraduationMaterialUpdateDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.updateUrl, data, true)
  }

  static search(data: GraduationMaterialSearchDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.searchUrl, data, false)
  }

  static delete(idList: Array<number>): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.deleteUrl, idList, true)
  }
}
